Introduction

FileMenu Tools lets you customize the context menu which is displayed when you click with right button of mouse over Windows Explorer, My Computer or Desktop. This application lets you configure the following aspects of the context menu:

· Add some build-in utilities in order to do operations over both files and folders. This utilities are:
· Run With Parameters.
· Command Line From Here.
· Copy/Move.
· Copy Path.
· Copy Name.
· Copy Content.
· Paste Clipboard.
· Attributes.
· Change Time.
· Split/Join File.
· Register/Unregister DLL.
· Find and Replace.
· Advanced Renamer.
· Change Icon.
· Advanced Delete.
· Synchronize two folders.
· Delete Locked File.
· Delete and no move to Recycle Bin.
· Shred Files.
· Create New Folder.
· Size of Folders.
· Add customized commands which lets you run external applications, copy/move to a specified folder, or delete specific file types.
· Customize the "Send to..." menu.
· Enable/Disable the commands which are added by other applications to the context menu.

The configuration window of FileMenu Tools is displayed below:


 Commands of FileMenu Tools

Commands of FileMenu Tools

FileMenu Tools lets you add both customized commands and some build-in utilities in order to do operations over both files and folders from the Windows Explorer. The build-in utilities are:

· Run With Parameters.
· Command Line From Here.
· Copy/Move.
· Copy Path.
· Copy Name.
· Copy Content.
· Paste Clipboard.
· Attributes.
· Change Time.
· Split/Join File.
· Register/Unregister DLL.
· Find and Replace.
· Advanced Renamer.
· Change Icon.
· Advanced Delete.
· Synchronize two folders.
· Delete Locked File.
· Delete and no move to Recycle Bin.
· Shred Files.
· Create New Folder.
· Size of Folders.

From Commands of FileMenu Tools tab of the configuration window, it is possible to configure both the customized commands and the build-in commands which will be displayed in the context menu of the Windows Explorer. On left side of each command exists a check box. If this check box is checked, the command will be displayed in context menu, in other case the command will be not displayed.

In both the Actions panel and the toolbar exist the following actions:

· Add Command. Add a new customized command. The properties are configured from the Properties panel.
· Add SubMenu. Add a new submenu to the context menu. To the submenus is possible to add either new elements or existing elements. In order to move existing elements into a submenu, you must drag and drop with the mouse pointer over the submenu. The text and icon to be displayed in the context menu must be configured from the Properties panel. Also it is possible to configure the submenu so when only a command is displayed in submenu, then that command is displayed in place of submenu. This can be configured with "Replace Single Command" option.
· Add Separator. Add a new separator.
· Delete. Remove the selected item. Only customized commands, submenus and separators can be removed. The build-in commands cannot be removed; if you wish to remove them from the context menu, you must uncheck the check box on left side of the command.
· Move Up. Move up the selected item.
· Move Down. Move down the selected item.


Run With Parameters

This utility lets you run a program with parameters typed through a dialog box.

This utility is displayed only for files with the following extension: .exe, .dll, .bat.


Command Line From Here

This utility opens a command line window whose working folder is the selected folder from the Windows Explorer.

This utility is displayed only when a folder is selected.


Copy/Move

This utility lets you copy/move the selected elements to other folder.

It shows the following window:

In order to copy/move to a specific folder, write the folder in Target Folder field, or select the folder either in the browser or in the Favorites list.

The folders which you use oftentimes can be added to the Favorites list. The Favorites are accessible from the Favorites tab. In order to add a folder to Favorites, write the folder in Target Folder field or select the folder in the browser, and click over Add to Favorites button from the Favorites tab.

If a file to copy/move exists in the target folder, by default a message box will be showed in order to ask you if you wish overwrite the file or not. If you don't want to be asked, the Overwrite existing files check box must be checked, and then all the existing files will be overwrited automatically.

Copy/move specific files

By default all the files are copied/moved recursively. If you want, you can copy/move specific file types only. From the combo box Files to copy/move, you can choose three options:

· All files. This options will copy/move all files and folders.
· Only files which match the filters. If checked, only the files which match the filters specified in Filters field will be copied/moved.
· Only files which do not match the filters. If checked, all the files will be copied/moved except the files which match the filters specified in Filters field.

The Filters field must contain each filter separated with a semicolon. The filters can contain the wildcard characters either * (zero or various characters of any type) or ? (a character of any type). For example, to match files with .exe extension or with .dll extension, you must use the following filter: *.exe;*.dll


Copy Path

This utility copies to the clipboard the path of all the selected elements in the Windows Explorer.


Copy Name

This utility copies to the clipboard the name of all the selected elements in the Windows Explorer.


Copy Content

This utility copies to the clipboard the content of the selected element in the Windows Explorer. If a file is selected, its content is copied; and if a folder is selected, the list with the name of all the files and all the subfolders that the selected folder contains is copied.


Paste Clipboard

This utility appends the clipboard contents into the selected elements. If a folder is selected, then will be created a file in that folder with the clipboard contents.

This utility only works with text files and with clipboards which contain text only.


Attributes

This utility lets you view and change the attributes of the selected elements from the Windows Explorer. It shows a submenu with all the available attributes. The attributes can be:

· Read only. Indicates if the element is read only, and therefore its content cannot be changed.
· Hidden. Indicates if the element is hidden, and therefore it will be not showed in Windows Explorer (unless the Windows Explorer had been configured to show hidden elements).
· System. Indicates if the element is a special element used by Windows.
· Modified. Indicates if the element has been modified after creating it.

If a specific attribute is activated, the option in the submenu display aon left side.

If the selected element in the Windows Explorer is a folder, the submenu Change in subfolders is enabled. The attributes changed from this submenu, will be changed recursively for all files and subfolders that the selected folder contains.


Change Time

This utility changes the creation time, the last write time and the last access time of the selected files in the Windows Explorer.

In order to change a specific time, check the check box on left side and change both the date and the time that you wish. You can change all the fields (year, month, day, hours, minutes, seconds) by using the keyboard. The date also can be changed with a calendar.

If the check box on left side of a time is not checked, that time will be not changed.

If any select element is a folder, you can check Change in all subfolders check box. If you check this option, the time will be changed in all the files that the selected folder contains.


Split/Join File

This utility splits the files in various parts.

From the window you can choose the size of each part and the target folder. Also is possible to compress the file in order to create minus number of parts. To compress the file check the Compress check box.

If you wish to know how many parts will be created, you can click in the button with the following icon: CalcularDividir. Note if you check the Compress option, is need compress the file previously to calculate the number of parts, and this can take several time, depending of the file size.

The first part of the file will be created with .prt extension, and the other parts will have the following extensions: ..p01, .p02, .p03, etc, depending of number of parts. The file name of the parts will be the same that the file name of the original file.

In order to build the original file again, select the file with .prt extension from the Windows Explorer and from the context menu, execute the Join Parts command.


Register/Unregister DLL

This utility registers or unregisters dinamyc link libraries in the Windows sytem, so applications can use them.

This utility is displayed for files with the following extensions: .dll, .ocx.


 Find and Replace

Find and Replace

This utility lets you find or replace a text recursively for all the files that a selected folder contains.

Find a text

In order to find a text, type the text you wish to search and the file types where you wish to search, and click over Find link.Then the text will be searched in all selected files. If Enter in all subfolders option is checked, all the files that the selected folders contain will be searched recursively. The results of the search will be displayed in the list on right side of the window. In this list is displayed the file path, the line number and the line where the text was found to. If you do double click over an element in the list, the file will be opened with associated application.

Replace a text

In order to replace a text with other text, type the text you wish to search, the text you wish to replace, and the file types where you wish to search, and click over Replace link. Then the text will be replaced in all selected files. If Enter in all subfolders option is checked, all the files that the selected folders contain will be replaced recursively. The results of the replacement will be displayed in the list on right side of the window. In this list is displayed the file path, the replaced line number, and the line where the text was replaced.

Also it is possible by replacing a text in specific lines of the found files in a previous search. In order to do this, when a search has finished, you must select the lines which you wish to replace and click over Replace selected lines only. When you do this, the text will be replaced in selected lines only.

Open and save the search results

After ending the searching or the replacing, the results are showed in a list. In this list is showed the file name, the line number, and the line text. It is possible save these results in a file by clicking over Save results link. In order to recover the results, you must click over Open results link.

Options

You can use the following options:

· Match case. If checked, all the characters of the text must match exactly with case.
· Match whole word only. If checked, the text must be limited with blank spaces or separated characters.
· Use regular expressions. If checked, you will may use regular expressions for the search text.
· Enter in all subfolders. If checked, the search process will search recursively in all subfolders that the selected folders contain.
· Create backup in "fmt_bak" folder. If checked, previously to replace a file, the file will be copied to subfolder named "fmt_bak". This subfolder will be in same folder that the file.

Profiles

If you use an specific configuration many times, it is possible save all the configuration in profiles and later you may recover the configuration quickly. The profiles are managed from the panel displayed in the bottom-left side of the window.

If you want to save the current configuration in a profile click over Save profile link. In the displayed dialog box you must specify the profile name; when you click over OK button, the profile will be add to the combo box which is showed in profiles panel. In order to load an existing profile, select it from the combo box and click over Load profile link. If you want to delete a profile, select it and click over Delete profile link.


Advanced Renamer

This utility lets you rename automatically all the selected files in the Windows Explorer. From the Advanced Renamer window you can configure the options to rename all the files. This window has two tabs: Basic Options and Advanced Options.

Basic Options

From Basic Options tab you can configure some parameters in order to change the name and/or the extension of the files. There are two option groups, one to change the name and other to change the extension. For both cases the options are the same.

From the String field you must specify a text and from the Location field you must specify where the text will be inserted to. There are three options: replace the text in place of the old name/extension, insert the text before the old name/extension or insert the text after the old name/extension. You also can add a sequence after the text. To do this, you must specify the first element of the sequence, and the sequence will be completed automatically. You can specify both numbers and letters. For example: if you specify 001, the sequence will be 001, 002, 003, 004, etc; or if you specify 0A, the sequence will be 0A, 0B, 0C, etc.

You also can convert the case of the name/exntension. You must specify this by checking Convert to check box and choose the case format from the combo box below the check box. You can choose convert to:

· losercase: all the characters are converted to lowercase.
· UPPERCASE: all the characters are converted to uppercase.
· Phrase format: the first character is uppercase and the other characters are lowercase.
· Title Format: the first character of each word is uppercase and the other characters are lowercase.

Advanced Options

From Advanced Options tab you can insert or replace a text into the name or the extension of the files. From the Apply to combo box you can specify where the changes will be applied to. There are two group options: Insert and Replace.

· Insert. You must specify the text to insert in String field and choose where the text will be inserted to. You can specify: insert in a a specific position (starting with 0), insert the text before a specific text, or insert the text after a specific text.
· Replace. There are two replace options:
· Replace the substring included from a position to a other position with the string specified in Change with field.
· Replace the text specified in Find string field with the text specified in Change with field. If Use regular expressions is checked you can use regular expressions in Find string field and Change with field.

If Match case option is checked, when a text is searched, the case of the all characters must coincide.

Preview

In the panel of the right side will be displayed a preview. In this preview you can view how the files will be renamed. There are two columns: old name and new name. The preview is updated automatically when you change some option.

You can move the files by dragging and dropping with the mouse pointer. This lets you sort the files when you configure a sequence from Basic Options tab.

If you don't want to rename a specific file, select the file in the preview and push the DEL key.


Change Icon

This utility lets you change the icon of the selected folder. All the folders normally have the same icon in the Windows Explorer, but some special folders have other icon (My Documents or My Pictures for example). In order to set an icon to any folder in the file system, you can use this utility of FileMenu Tools.

This utility is displayed only if you select a folder.

If you want to set the default icon, choose Default icon option; and if you want to set other icon, choose Other icon option. In order to select the icon, click over BotonExplorar button. Then a window will be showed which lets you browse the wanted icon.


Advanced Delete

This utility lets you delete specific file types. This can be used to delete temporary files for example. This utility is displayed only if you select a folder in the Windows Explorer.

There are two options to delete the files depending of the type:

· Delete the files which match the filters. Example: in order to delete all the files with either tmp or dat extensions, you must specify "*.tmp;*.dat" in the "Filters" field.
· Delete the files which do not match the filters. Example: in order to delete all the files but those with txt extension, you must specify "*.txt" in the "Filters" field.

The filters can contain wildcards and each filter must be separated with a semicolon. The wildcards can be either * (zero or various characters of any type) or ? (a character of any type). Example: the "file.txt" file matches the "*.txt" filter, but it does not match the "*.tmp" filter.

By clicking over the Find button, the files which match or not match the filters (depending of the selected option) will be searched and the results will be displayed in the list of the window. You can select the files that you want to delete and click over Delete Selected button.

If you click over Find and Delete button, the files will be searched and deleted immediately. In this case the files will be not displayed in the list.

Options

· Find in subfolders. If checked, the search process will search recursively in all subfolders that the selected folders contain.
· Move to recycle bin. If checked, the files will be moved to recycle bin and will be not deleted.


Synchronize Folders

This utility lets you synchronize two folders. From the Windows Explorer, select a folder and from the context menu choose the "Synchronize..." command. The following window will be showed:

From Folder 2 field, specify the other folder that you want to synchronize with. You also can specify the file types that you want to synchronize and the synchronization type.

When you have configured all the options, click over Next button. Then all changes in both folders will be analyzed and showed in the following window:

Depending of the changes which will be realized in both folders, the icons of the folders and files will be showed with the following colors:

· Green: elements will be added.
· Red: elements will be deleted.
· Blue: elements will be replaced.

If you don't want to apply an specific change, select the change and click over Remove Change button.

Click over OK button in order to start the synchronization process.

Synchronization Types

You can specify the following synchronization types:

· Unidirectional, Folder 1 -> Folder 2. If you select this option, the Folder 2 will be modified in order to be equal to Folder 1. The Folder 1 will be kept unchanged. The following changes will be do to Folder 2:
· Add the elements that exist in Folder 1 but not in Folder 2.
· Replace the elements that exist in both folders, but in Folder 1 they are newer than in Folder 2.
· Delete the elements that exist in Folder 2 but not in Folder 1.
· Unidirectional, Folder1 <- Folder2. If you select this option, the Folder 1 will be modified in order to be equal to Folder 2. The Folder 2 will be kept unchanged. The following changes will be do to Folder 1:
· Add the elements that exist in Folder 2 but not in Folder 1.
· Replace the elements that exist in both folders, but in Folder 2 they are newer than in Folder 1.
· Delete the elements that exist in Folder 1 but not in Folder 2.
· Bidirectional, Folder1 <-> Folder2. If you select this option, both folders will be modified in order to be equals. The following changes will be do to both folders:
· Add to Folder 1 the elements that exist in Folder 2 but not in Folder 1.
· Add to Folder 2 the elements that exist in Folder 1 but not in Folder 2.
· Replace in Folder 1 the elements that exist in both folders, but in Folder 2 are newer than in Folder 1.
· Replace in Folder 2 the elements that exist in both folders, but in Folder 1 are newer than in Folder 2.
· Customized. If you select this option, you will may customize the changes to realize to both folders.

File Types to synchronize

If you want, you can synchronize some file types only. In the Files combo box, you can choose the following options:

· All files. This options will synchronize all files and folders.
· Only files which match the filters. If checked, only the files which match the filters specified in Filters field will be synchronized.
· Only files which do not match the filters. If checked, all the files will be synchronized except the files which match the filters specified in Filters field.

The Filters field must contain each filter separated with a semicolon. The filters can contain the wildcard characters either * (zero or various characters of any type) or ? (a character of any type). For example, to match files with .exe extension or with .dll extension, you must use the following filter: *.exe;*.dll

Profiles

You can save the configuration in profiles, so if an specific configuration is used various times, you can configure a profile and then load that profile each time you want to use that configuration. At the bottom side of the window a combo box exists with the profiles names and three buttons that you lets load, save or delete the profiles, respectively. All configuration is saved in the profile except the Folder 1, which is always selected from the Windows Explorer.


Delete Locked File

Eliminar archivos bloqueados

This utility lets you delete the locked files. Sometimes files cannot be deleted because they are been used by any application and therefore they are locked. This utility lets you mark this type of files to be deleted for the next system boot, before any application can lock them.


Delete and no move to Recycle Bin

This utility lets you delete files and/or folders definitely and no move them to Recycle Bin. It do the same functionality that to press SHIFT key when deleting elements from Windows Explorer.


Shred Files

This utility lets you shred the selected files definitely so it is imposible to recovery the files with recovering tools. As you may or may not know, Windows doesn’t actually delete a file when you choose the Windows delete command. The file remains on your hard disk and Windows only removes the entry to it from the FAT (File Allocation Table) so that the system doesn’t see the file. But with recovering tools, these files can be found and recovered again as long as they haven’t been overwritten by new data yet. With secret files this can be a problem. This utility overwrites until three times the file content so it is imposible to recovery the file in the future.


Create New Folder

This utility lets you create a new subfolder in the selected folder.

This utility is displayed only if you select a folder.


Size of Folders

This utility lets you see the size of the folders. If only a folder is selected, then it will be displayed the size of all its subfolders; and if various folder are selected, then it will displayed the size of these folders.

The window that will be showed is:

In the list is showed the size of each folder and the percentage. Below the list is showed the total size and below the window is showed a pie chart that shows graphically the percentage.

Double-click over a folder in the list to analyze the size of all its subfolders. Push over UpLevel button to analyze all the subfolders of the parent folder.


 Customized Commands

Customized Commands

FileMenu Tools lets you configure customized commands which will be added to context menu of the Windows Explorer. There are four command types which let you make specific actions. This actions are:

· Run an external program, whose arguments are the selected elements.
· Copy the selected elements to an specific folder.
· Move the selected elements to an specific folder.
· Delete specific file types into the selected folders.

From the Commands of FileMenu Tools tab of the configuration window you can add new commands, delete commands and change the command properties.

In order to add a new command click Add Command action. The new command will be added to the list and its name will be New Command.

In order to change the properties of a command, you must use the properties panel. There are common properties and specific properties for each command type.

Common Properties

· Action. The action which will be run: run program, copy to a folder, move to a folder, or delete specific files.
· Menu Text. The text which will be displayed in the context menu.
· Icon. The icon which will be displayed in the context menu. If you click the right side button then a dialog box will be displayed to browse and select the icon.
· Element Types. The command will be displayed only when any selected element in the Windows Explorer belongs to any of these element types. The element types can be either folders or files. If you choose files, you must specify the file extensions separated with a comma. If you wish to specify all file types, enter * wildcard. By default, all files are displayed when various files are selected, but if you want you can set the "Only an element" option to "Yes" in order to display the command only when a file is selected.

Program Properties

· Program. The full path of the program file.
· Arguments. The arguments which must be given to the program. If you don't specify this field, by default, the arguments will be the path of all the selected elements in the Windows Explorer. You can specify various variables which will be replaced with its value when the program runs. In order to insert a variable, click over the right side button and select the variable from the context menu. The possible variables are the following:
· %DRIVE%: drive letter which is common to the all selected elements.
· %FOLDERPATH%: parent folder path which is common to all the selected elements.
· %FILEPATHS%: full paths of the all selected elements. This is the default variable if you don't specify any argument.
· %FILENAMES%: file names of the all selected elements.
· %FILEPATHn%: full path of the element at position n.
· %FILENAMEn%: file name of the element at position n.
· %FILEEXTn%: extension of the element at position n.
· @Message@: customized variable. The variable value will be requested when the program runs. Message is the text which will be displayed when the value is requested.
· @OPENFILE:Message@: lets you select a file when the program runs. The Open File Dialog will be showed to select the file. Message is the text which will be displayed in the dialog.
· @SAVEFILE:Message@: lets you select a file for save when the program runs. The Save File Dialog will be showed to select the file. Message is the text which will be displayed in the dialog.
· @FOLDER:Message@: lets you select a folder when the program runs. A dialog will be showed to select the folder. Message is the text which will be displayed in the dialog.
· Working Folder. The working folder which the program will be run. You can specify the following variables:
· %DRIVE%: drive letter which is common to the all selected elements.
· %FOLDERPATH%: parent folder which is common to all the selected elements.

Copy/Move Properties

· Target Folder. The folder where the selected elements will be copied/moved to.
· File Types. The file types to copy/move. There are three options: all files, only files match the filters, or only files does not match the filters. If you choose any of last two options, you must specify the file types.
· Overwrite. If checked, when coping/moving an existing file, you will be asked if the file must be overwrited or not.

Delete Properties

· File Types. The file types to delete.
· Enter in subfolders. If checked, the delete process will delete recursively in all subfolders that the selected folders contain.
· Move to Recycle Bin. If checked, the files will be moved to recycle bin and will be not deleted.


 "Send to..." menu

"Send to..." menu

FileMenu Tools lets you configure the "Send to" submenu. You can add new elements, change the properties of the existing elements and delete them. You also can disable the existing elements in order to hide from the menu.

You can configure the "Send to" menu from the "Send to" menu tab in the configuration window of FileMenu Tools.

You can add new elements by clicking the Add Command action.

In order to delete an existing element click Delete action.

If you want to hide an existing element, uncheck the left side check box of the element.

In order to change the properties of an element, select the element and change its properties from the properties panel. You can change the following properties:

· Name. The text which will be displayed in the menu.
· Target. The program which must be run. The full path must be specified.
· Arguments. The arguments which will be given to the program.
· Working Folder. The working folder where the program will be run from.
· Icon. The icon which will be displayed in the menu. If you click over the right side button, a dialog will be displayed to select the icon in the file system. You can choose an icon with .ico extension or an icon into an icon library (.exe, .dll, .icl, etc.).
· Description. A comment about the program.

NOTE: there are special commands which cannot changed. Only the elements which are displayed with bold font in the configuration window are commands that you can change its properties.


Commands of other applications

FileMenu Tools lets you enable/disable the commands which are added to the context menu of the Windows Explorer by other programs.

You can configure this from the Commands of other applications tab of the configuration window.

In the configuration Window there is a tree with two levels. The first level displays the object types, and the second level displays the applications which add commands to the context menu when you select a object type of the first level. The object types can be as the following:

· All file types (both files and folders).
· All file system objects (files, folders and special objects).
· Drives.
· Directories.
· Folders.
· Shortcuts.
· Internet shortcuts.
· MS-DOS shortcuts.
· Recycle Bin.
· Printers.
· My Documents.

In order to disable a command, uncheck the left side check box of the element. If you uncheck an object type (first level node), all the commands which are children of the node will be unchecked.


.topic 1004
The properties panel of the FileMenu Tools configuration window lets you change the properties of the selected element. Normally this panel is showed at bottom-left side of the window. In order to show this panel, you must click on Properties toolbar button or Edit/Properties menu command.

.topic 1002
The file types are specified by using filters which can contain wildcards. The wildcards can be either * (zero or various characters of any type) or ? (a character of any type). Each filter must be separated with a semicolon.
Example: *.htm;*.html


Regular Expression Class Names

 Top

Name | Description
alnum | Any alpha-numeric character.
alpha | Any alphabetic character.
blank | Any whitespace character that is not a line separator.
cntrl | Any control character.
d | Any decimal digit
digit | Any decimal digit.
graph | Any graphical character.
l | Any lower case character.
lower | Any lower case character.
print | Any printable character.
punct | Any punctuation character.
s | Any whitespace character.
space | Any whitespace character.
unicode | Any extended character whose code point is above 255 in value.
u | Any upper case character.
upper | Any upper case character.
w | Any word character (alphanumeric characters plus the underscore).
word | Any word character (alphanumeric characters plus the underscore).
xdigit | Any hexadecimal digit character.


Regular Expression Symbolic Names

 Top

The following symbolic names are recognised as valid collating element names, in addition to any single character:

Name | Character
NUL | \x00
SOH | \x01
STX | \x02
ETX | \x03
EOT | \x04
ENQ | \x05
ACK | \x06
alert | \x07
backspace | \x08
tab | \t
newline | \n
vertical-tab | \v
form-feed | \f
carriage-return | \r
SO | \xE
SI | \xF
DLE | \x10
DC1 | \x11
DC2 | \x12
DC3 | \x13
DC4 | \x14
NAK | \x15
SYN | \x16
ETB | \x17
CAN | \x18
EM | \x19
SUB | \x1A
ESC | \x1B
IS4 | \x1C
IS3 | \x1D
IS2 | \x1E
IS1 | \x1F
space | \x20
exclamation-mark | !
quotation-mark | "
number-sign | #
dollar-sign | $
percent-sign | %
ampersand | &
apostrophe | '
left-parenthesis | (
right-parenthesis | )
asterisk | *
plus-sign | +
comma | ,
hyphen | -
period | .
slash | /
zero | 0
one | 1
two | 2
three | 3
four | 4
five | 5
six | 6
seven | 7
eight | 8
nine | 9
colon | :
semicolon | ;
less-than-sign | <
equals-sign | =
greater-than-sign | >
question-mark | ?
commercial-at | @
left-square-bracket | [
backslash | \
right-square-bracket | ]
circumflex | ~
underscore | _
grave-accent | `
left-curly-bracket | {
vertical-line | |
right-curly-bracket | }
tilde | ~
DEL | \x7F


Regular Expressions

 Top

FileMenu Tools uses the Perl regular expression syntax. This syntax is based on that used by the programming language Perl. With regular expressions you may define search and replace patterns.

In Perl regular expressions, all characters match themselves except for the following special characters:

.[]{}()\*+?|^$

Wildcard

The single character '.' when used outside of a character set will match any single character except the newline character.

Anchors

A ^ character shall match the start of a line.

A $ character shall match the end of a line.

Marked sub-expressions

A section beginning ( and ending ) acts as a marked sub-expression. Whatever matched the sub-expression is split out in a separate field by the matching algorithms. Marked sub-expressions can also repeated, or referred to by a back-reference.

Non-marking grouping

A marked sub-expression is useful to lexically group part of a regular expression, but has the side-effect of spitting out an extra field in the result. As an alternative you can lexically group part of a regular expression, without generating a marked sub-expression by using (?: and ) , for example (?:ab)+ will repeat "ab" without splitting out any separate sub-expressions.

Repeats

Any atom (a single character, a marked sub-expression, or a character class) can be repeated with the *, +, ?, and {} operators.

The * operator will match the preceding atom zero or more times, for example the expression a*b will match any of the following:

b

ab

aaaaaaaab

The + operator will match the preceding atom one or more times, for example the expression a+b will match any of the following:

ab

aaaaaaaab

But will not match:

b

The ? operator will match the preceding atom zero or one times, for example the expression ca?b will match any of the following:

cb

cab

But will not match:

caab

An atom can also be repeated with a bounded repeat:

· a{n} Matches 'a' repeated exactly n times.
· a{n,} Matches 'a' repeated n or more times.
· a{n, m} Matches 'a' repeated between n and m times inclusive.

For example:

^a{2,3}$

Will match either of:

aa

aaa

But neither of:

a

aaaa

It is an error to use a repeat operator, if the preceding construct can not be repeated, for example:

a(*)

Will raise an error, as there is nothing for the * operator to be applied to.

Non greedy repeats

The normal repeat operators are "greedy", that is to say they will consume as much input as possible. There are non-greedy versions available that will consume as little input as possible while still producing a match.

*? Matches the previous atom zero or more times, while consuming as little input as possible.

+? Matches the previous atom one or more times, while consuming as little input as possible.

?? Matches the previous atom zero or one times, while consuming as little input as possible.

{n,}? Matches the previous atom n or more times, while consuming as little input as possible.

{n,m}? Matches the previous atom between n and m times, while consuming as little input as possible.

Back references

An escape character followed by a digit n, where n is in the range 1-9, matches the same string that was matched by sub-expression n. For example the expression:

^(a*).*\1$

Will match the string:

aaabbaaa

But not the string:

aaabba

Back references can be used also when replacing a text.

Alternation

The | operator will match either of its arguments, so for example: abc|def will match either "abc" or "def".

Parenthesis can be used to group alternations, for example: ab(d|ef) will match either of "abd" or "abef".

Empty alternatives are not allowed (these are almost always a mistake), but if you really want an empty alternative use (?:) as a placeholder, for example:

"|abc" is not a valid expression, but
"(?:)|abc" is and is equivalent, also the expression:
"(?:abc)??" has exactly the same effect.

Character sets:

A character set is a bracket-expression starting with [ and ending with ], it defines a set of characters, and matches any single character that is a member of that set.

A bracket expression may contain any combination of the following:

Single characters:

For example [abc], will match any of the characters 'a', 'b', or 'c'.

Character ranges:

For example [a-c] will match any single character in the range 'a' to 'c'. By default, for POSIX-Perl regular expressions, a character x is within the range y to z, if it collates within that range; this results in locale specific behavior.

Negation:

If the bracket-expression begins with the ^ character, then it matches the complement of the characters it contains, for example [^a-c] matches any character that is not in the range a-c.

Character classes:

An expression of the form [[:name:]] matches the named character class "name", for example [[:lower:]] matches any lower case character. See character class names.

Collating Elements:

An expression of the form [[.col.] matches the collating element col. A collating element is any single character, or any sequence of characters that collates as a single unit. Collating elements may also be used as the end point of a range, for example: [[.ae.]-c] matches the character sequence "ae", plus any single character in the range "ae"-c, assuming that "ae" is treated as a single collating element in the current locale.

As an extension, a collating element may also be specified via it's symbolic name, for example:

[[.NUL.]]

matches a NUL character.

Equivalence classes:

An expression oftheform[[=col=]], matches any character or collating element whose primary sort key is the same as that for collating element col, as with colating elements the name col may be a symbolic name. A primary sort key is one that ignores case, accentation, or locale-specific tailorings; so for example [[=a=]] matches any of the characters: a, à, á, â, ã, ä, å, A, À, Á, Â, Ã, Ä and Å. Unfortunately implementation of this is reliant on the platform's collation and localisation support; this feature can not be relied upon to work portably across all platforms, or even all locales on one platform.

Escapes:

All the escape sequences that match a single character, or a single character class are permitted within a character class definition, except the negated character classes (\D \W etc).

Combinations:

All of the above can be combined in one character set declaration, for example: [[:digit:]a-c[.NUL.]].

Escapes

Any special character preceded by an escape shall match itself.

The following escape sequences are also supported:

Escapes matching a specific character

The following escape sequences are all synonyms for single characters:

Escape | Character
\a | '\a'
\e | 0x1B
\f | \f
\n | \n
\r | \r
\t | \t
\v | \v
\b | \b (but only inside a character class declaration).
\cX | An ASCII escape sequence - the character whose code point is X % 32
\xdd | A hexadecimal escape sequence - matches the single character whose code point is 0xdd.
\x{dddd} | A hexadecimal escape sequence - matches the single character whose code point is 0xdddd.
\0ddd | An octal escape sequence - matches the single character whose code point is 0ddd.
\N{name} | Matches the single character which has the symbolic name name. For example \N{newline} matches the single character \n.

"Single character" character classes:

Any escaped character x, if x is the name of a character class shall match any character that is a member of that class, and any escaped character X, if x is the name of a character class, shall match any character not in that class.

The following are supported by default:

Escape sequence | Equivalent to
\d | [[:digit:]]
\l | [[:lower:]]
\s | [[:space:]]
\u | [[:upper:]]
\w | [[:word:]]
\D | [^[:digit:]]
\L | [^[:lower:]]
\S | [^[:space:]]
\U | [^[:upper:]]
\W | [^[:word:]]

Character Properties

The character property names in the following table are all equivalent to the names used in character classes.

Form | Description | Equivalent character set form
\pX | Matches any character that has the property X. | [[:X:]]
\p{Name} | Matches any character that has the property Name. | [[:Name:]]
\PX | Matches any character that does not have the property X. | [^[:X:]]
\P{Name} | Matches any character that does not have the property Name. | [^[:Name:]]

Word Boundaries

The following escape sequences match the boundaries of words:

\< | Matches the start of a word.
\> | Matches the end of a word.
\b | Matches a word boundary (the start or end of a word).
\B | Matches only when not at a word boundary.

Buffer boundaries

The following match only at buffer boundaries: a "buffer" in this context is the whole of the input text that is being matched against (note that ^ and $ may match embedded newlines within the text).

\` | Matches at the start of a buffer only.
\' | Matches at the end of a buffer only.
\A | Matches at the start of a buffer only (the same as \`).
\z | Matches at the end of a buffer only (the same as \').
\Z | Matches an optional sequence of newlines at the end of a buffer: equivalent to the regular expression \n*\z

Continuation Escape

The sequence \G matches only at the end of the last match found, or at the start of the text being matched if no previous match was found. This escape useful if you're iterating over the matches contained within a text, and you want each subsequence match to start where the last one ended.

Quoting escape

The escape sequence \Q begins a "quoted sequence": all the subsequent characters are treated as literals, until either the end of the regular expression or \E is found. For example the expression: \Q\*+\Ea+ would match either of:

\*+a
\*+aaa

Unicode escapes

\C | Matches a single code point: in Boost regex this has exactly the same effect as a "." operator.
\X | Matches a combining character sequence: that is any non-combining character followed by a sequence of zero or more combining characters.

Any other escape

Any other escape sequence matches the character that is escaped, for example \@ matches a literal '@'.

Perl Extended Patterns

Perl-specific extensions to the regular expression syntax all start with (?.

Comments

(?# ... ) is treated as a comment, it's contents are ignored.

Modifiers

(?imsx-imsx ... ) alters which of the perl modifiers are in effect within the pattern, changes take effect from the point that the block is first seen and extend to any enclosing ). Letters before a '-' turn that perl modifier on, letters afterward, turn it off.

(?imsx-imsx:pattern) applies the specified modifiers to pattern only.

Non-marking grouping

(?:pattern) lexically groups pattern, without generating an additional sub-expression.

Lookahead

(?=pattern) consumes zero characters, only if pattern matches.

(?!pattern) consumes zero characters, only if pattern does not match.

Lookahead is typically used to create the logical AND of two regular expressions, for example if a password must contain a lower case letter, an upper case letter, a punctuation symbol, and be at least 6 characters long, then the expression:

(?=.*[[:lower:]])(?=.*[[:upper:]])(?=.*[[:punct:]]).{6,}

could be used to validate the password.

Lookbehind

(?<=pattern) consumes zero characters, only if pattern could be matched against the characters preceding the current position (pattern must be of fixed length).

(?<!pattern) consumes zero characters, only if pattern could not be matched against the characters preceding the current position (pattern must be of fixed length).

Independent sub-expressions

(?>pattern) pattern is matched independently of the surrounding patterns, the expression will never backtrack into pattern. Independent sub-expressions are typically used to improve performance; only the best possible match for pattern will be considered, if this doesn't allow the expression as a whole to match then no match is found at all.

Conditional Expressions

(?(condition)yes-pattern|no-pattern) attempts to match yes-pattern if the condition is true, otherwise attempts to match no-pattern.

(?(condition)yes-pattern) attempts to match yes-pattern if the condition is true, otherwise fails.

Condition may be either a forward lookahead assert, or the index of a marked sub-expression (the condition becomes true if the sub-expression has been matched).

Operator precedence

The order of precedence for of operators is as shown in the following table:

Collation-related bracket symbols | [==] [::] [..]
Escaped characters | \
Character set (bracket expression) | []
Grouping | ()
Single-character-ERE duplication | * + ? {m,n}
Concatenation |
Anchoring | ^$
Alternation | |

What gets matched

If you view the regular expression as a directed (possibly cyclic) graph, then the best match found is the first match found by a depth-first-search performed on that graph, while matching the input text.

Alternatively:

the best match found is the leftmost match, with individual elements matched as follows;

Construct | What gets matches
AtomA AtomB | Locates the best match for AtomA that has a following match for AtomB.
Expression1 | Expression2 | If Expresion1 can be matched then returns that match, otherwise attempts to match Expression2.
S{N} | Matches S repeated exactly N times.
S{N,M} | Matches S repeated between N and M times, and as many times as possible.
S{N,M}? | Matches S repeated between N and M times, and as few times as possible.
S?, S*, S+ | The same as S{0,1}, S{0,UINT_MAX}, S{1,UINT_MAX} respectively.
S??, S*?, S+? | The same as S{0,1}?, S{0,UINT_MAX}?, S{1,UINT_MAX}? respectively.
(?>S) | Matches the best match for S, and only that.
(?=S), (?<=S) | Matches only the best match for S (this is only visible if there are capturing parenthesis within S).
(?!S), (?<!S) | Considers only whether a match for S exists or not.
(?(condition)yes-pattern | no-pattern) | If condition is true, then only yes-pattern is considered, otherwise only no-pattern is considered.